#include "priority-queue.tpl.h"
#include "pqueue-widx.h"
#include <functional>
#include <stdio.h>

using std::less;


int main(void) {
    PQueue<int>pq; 
    PQueue<int, less<int>> pq2(less<int>{});
    auto cmp = [](int const a, int const b) -> bool { return a<b;};
    PQueue<int, decltype(cmp)> pq3(cmp);
    int i;
    for(i=10; i>5; i--) {
        pq3.push_back(i);
    }
    pq3.make_heap();
    while(i>0) {
        pq3.push(i);
        i--;
    }
    while(! pq3.empty()) {
        printf("dequeue: %d\n", pq3.dequeue());
    }
    pq3.clear();
    printf("size after clear: %d\n", pq3.size());
    using CmpFunc=PQueueWidx::CmpFunc;
    PQueueWidx pq4(CmpFunc{cmp});
    for(i=10; i>5; i--) {
        pq4.push_back(i);
    }
    pq4.make_heap();
    pq4.up_fix_heap(6);
    pq4.up_fix_heap(10);
    while(i>0) {
        pq4.push(i);
        i--;
    }
    while(!pq4.empty()) {
        printf("dequeue: %d\n", pq4.dequeue());
    }
    pq4.clear();
    printf("size after clear: %d\n", pq3.size());
    return 0;
}

